package com.e3.bill.client;

import com.e3.template.tgf.TGFPagingGridPanel;
import com.e3.web.core.model.SuperModel;
import com.extjs.gxt.ui.client.data.ListLoader;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GroupSummaryView;

public abstract class BillPagingGridPanel<D extends SuperModel> extends TGFPagingGridPanel<D>{
	
	@Override
	protected Grid<D> getGrid() {
		Grid<D> grid = super.getGrid();
		GroupSummaryView summary = new GroupSummaryView();  
	    summary.setForceFit(true);  
	    summary.setShowGroupedColumn(false);
	    grid.setView(summary);
	    grid.getView().setShowDirtyCells(false); 
	    return grid;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	protected ListStore<D> createGridStore(ListLoader loader) {
		ListStore listStore = null;
		if(loader == null){
			listStore = new GroupingStore();
		}
		else{
			listStore = new GroupingStore(loader);
		}
		listStore.setModelComparer(modelHelper.getModelComparer());
		listStore.setKeyProvider(modelHelper.getModelKeyProvider());
		return listStore;
	}
	protected abstract D createModelInstance();			
}
